/**************************************************************************************************/
/*                                    NEW FORM                                                    */
/**************************************************************************************************/

client
	Admin
		verb {
			Admin_Form() {
				set
					hidden = 1
					name = "Admin"
				var
					Full_Page
					Header = {"<html>
	<head>
		<title>Moderation</title>
		"}
					Javascript = ""
					CSS = {"<style type = "text/css">
	body{background: #000; color: #CCC;}
	.moderation{background: #1133FF; border: 2px groove #1133FF; width: 400px; padding: 0px; position: absolute; left: 0px; top: 0px}
	.moderation td, .moderation th{background: #000; border: 2px groove #66AADD; width: 50%;}
	.select select{width: 100%;}
</style>"}
					Page = {"
		</head>
	<body>
		<table class="moderation">
			<tr><th colspan="2">Moderation</th></tr>
			<tr><td class="select">
				<select name="chatters" size="10" multiple="multiple">"}
				for(var/client/Target) Page+="<option>[Target.key]</option>"
				Page+={"</select></td>
				<td class="select">
					<select size="10" multule="multiple">
						<option>Mute</option>
						<option>Unmute</option>
						<option>Ban</option>
						<option>Unban</option>
					</select>
				</td>
					</tr>


		</table>
	</body>
</html>"}
				Full_Page = "[Header][Javascript][CSS][Page]"
				src<<browse(Full_Page,"window=moderation;size=400x400;can_resize=0")
			}
		}

/**************************************************************************************************/
/*                                    Admin Stuff                                                 */
/**************************************************************************************************/

client/Admin/verb {
	SetTopic() {
		set hidden = 1
		ConversationTopic = input("Please set a topic.","Topic",ConversationTopic)
		for(var/client/M) {winset(M,"Main.Topic","text=\"[ConversationTopic]\"")}
		System_WorldMessage("[src] has changed the topic.")
	}

	/* This will all be in a browse window at some point */
	Mute(target as text) {
		set hidden = 1
		var/client/Target
		Target = findTarget(target)
		if(!Target)
			System_UserMessage(src,"You can't mute [target], because whoever that is doesn't exist. Derp")
			return
		if(Target.Muted) {
			System_UserMessage(src,"You can't mute [Target], they are already muted.")
		}
		else {
			Target.Muted = 1
			MuteList+=Target
			System_WorldMessage("[Target] has been muted.")
		}
	}

	UnMute(var/client/Target in MuteList) {
		set hidden = 1
		if(!Target.Muted) {
			System_UserMessage(src,"You know, [Target] isn't even muted.")
		}
		else {
			Target.Muted = 0
			System_WorldMessage("[Target] is no longer muted.")
		}
	}

	Ban(target as text) {
		set hidden = 1
		var/client/Target
		Target = findTarget(target)
		if(!Target)
			System_UserMessage(src,"You can't ban [target], because whoever that is doesn't exist. Derp")
			return
		Banned+=Target
		System_WorldMessage("[Target] has been banned.")
		del(Target)
	}

	UnBan(var/mob/Target in Banned) {
		set hidden = 1
		System_WorldMessage("[Target] is no longer banned.")
		Banned-=Target
	}
}

client/SuperAdmin/verb {

	Promote(target as text) {
		set hidden = 1
		var/client/Target
		Target = findTarget(target)
		if(!Target)
			System_UserMessage(src,"You can't promote [target], because whoever that is doesn't exist. Derp")
			return
		if(Target.ckey in Admins) {
			return
		}
		else {

			Admins += Target.ckey

			Target.verbs += typesof(/client/Admin/verb)
			Target.Grid_Color = "blue"
			Target.Font_Weight = "bold"
			winset(Target,"Main","menu=Admin")

			System_WorldMessage("[Target] has been promoted to Operator.")

		}
	}

	Demote(target as text) {
		set hidden = 1
		var/client/Target
		Target = findTarget(target)
		if(!Target)
			System_UserMessage(src,"You can't demote [target], because whoever that is doesn't exist. Derp")
			return
		if(Target.ckey in Admins) {

			Admins-=Target.ckey

			Target.verbs -= typesof(/client/Admin/verb)
			Target.Grid_Color = "black"
			Target.Font_Weight = "normal"
			winset(Target,"Main","menu=main")

			System_WorldMessage("[Target] has been demoted to Chatter.")
		}
		else {
			return
		}
	}
}